package com.kinggm.service.factory.abs.impl;

import com.kinggm.service.factory.abs.Pizza;
import com.kinggm.service.factory.abs.PizzaStore;
import com.kinggm.service.factory.service.PizzaIngredientFactory;
import com.kinggm.service.factory.service.impl.ChinaIngredientFactory;
import com.kinggm.service.factory.service.impl.NYPizzaIngredientFactory;

public class NYPizzaStore extends PizzaStore {

    @Override
    protected Pizza createPizza(String type) {

        if("cheese".equals(type)){
            NYPizzaIngredientFactory nyPizzaIngredientFactory = new NYPizzaIngredientFactory();
            NYStyleCheesePizza nyStyleCheesePizza = new NYStyleCheesePizza(nyPizzaIngredientFactory);
            nyStyleCheesePizza.setName("纽约风味奶酪披萨！");
            return nyStyleCheesePizza;
        }else if("china".equals(type)){
            PizzaIngredientFactory chinaIngredientFactory = new ChinaIngredientFactory();
            Pizza chinaPizza = new ChinaPizza(chinaIngredientFactory);
            chinaPizza.setName("中国调料的纽约风味奶酪披萨！");
            return chinaPizza;
        }

        return null;
    }
}
